﻿@using Smartstore.Core.Search.Facets

@model FacetGroup

@{
    var facets = Model.Facets.Where(x => x.Published).Reverse().Skip(1);
    if (!facets.Any())
    {
        return;
    }
}

<div class="facet-body-inner facet-body-rating" 
     role="radiogroup"
     data-manualselect="true"
     aria-orientation="vertical" 
     aria-labelledby="facet-group-header-@Model.Key">
    @foreach (var facet in facets)
    {
        <div class="facet-item facet-radio" title="@facet.Value.Label">
            <label class="choice-box-label" for="optradio-@(facet.Value.Key)">
                <input class="facet-control-native"
                       type="radio"
                       name="optradio-@(Model.Key)"
                       id="optradio-@(facet.Value.Key)"
                       value="@facet.Value.ToString()"
                       aria-label="@(facet.Value.Label ?? facet.Value.ToString())"
                       attr-checked='(facet.Value.IsSelected, "checked")'
                       data-href="@Url.FacetToggle(facet)" />
                <span class="facet-control-ui" aria-hidden="true"></span>
                <span class="facet-label has-count" attr-data-count='(facet.HitCount > 0, facet.HitCount.ToString("N0"))'>
                    <span class="rating">
                        <span style="width: @(facet.Value.Value.Convert<int>() * 20)%"></span>
                    </span>
                    <span>@T("Search.Facet.StarsAndMore")</span>
                </span>
            </label>
        </div>
    }
</div>